package com.neusoft.demo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neusoft.demo.dao.UserMapper;
import com.neusoft.demo.po.User;
import com.neusoft.demo.service.UserService;
@Service
public class UserServiceImpl implements UserService {
	@Autowired
	UserMapper userMapper;

	/**
	 * 添加用户
	 */

	@Override
	public void saveUser(User user) {
		userMapper.saveUser(user);

	}

	/**
	 * 查询所有用户
	 */
	@Override
	public List<User> findAll() {
		List<User> allUser = userMapper.findAll();

		return allUser;
	}
	/**
	 * 通过ID查询用户
	 */
	@Override
	public User findUserById(Integer uid) {
		User user=userMapper.findUserById(uid);
		return user;
	}

	/**
	 * 删除用户
	 */
	@Override
	public boolean deleteUser(Integer uid) {
		return userMapper.deleteUser(uid);
	}
	/**
	 * 更新用户
	 */
	@Override
	public boolean updateUser(User user) {
          return userMapper.updateUser(user);

	}
	/**
	 * 模糊查询
	 */
	@Override
	public List<User> findByName(String Uname) {
		//System.out.println(Uname);
		return userMapper.findByName(Uname);
	}

	@Override
	public List<User> findId(Integer uid) {
		
		return userMapper.findId(uid);
	}

	@Override
	public User findByUser(User user) {
		
		return userMapper.findByUser(user);
	}

	@Override
	public void regiseter(User user) {
		userMapper.register(user);

	}

	@Override
	public User findById(Integer uid) {
		
		return userMapper.findById(uid);
	}

}
